<template>
	<view class="container">
		<view class="status_bar">
			<!-- 这里是状态栏 -->
		</view>
		<view class="placeholder">
			<view class="custom-navigation flex justify-between align-center">
				<u-icon name="arrow-left" size="40" @tap="back"></u-icon>
				<text class="header-title">省心投</text>
				<router-link to="/pages/moneyRecord/moneyRecord" class="account-record">资金记录</router-link>
			</view>
		</view>
		<view class="info-wrapper">
			<view class="attr-list flex">
				<view class="attr-item flex align-center justify-center">
					<view class="attr-icon attr-icon-1"></view>
					<text class="attr-text">专家配置</text>
				</view>
				<view class="attr-item flex align-center justify-center">
					<view class="attr-icon attr-icon-3"></view>
					<text class="attr-text">自动调仓</text>
				</view>
				<view class="attr-item flex align-center justify-center">
					<view class="attr-icon attr-icon-3"></view>
					<text class="attr-text">长期投资</text>
				</view>
			</view>
			<view class="total-money-info flex flex-column">
				<view class="total-label">持有总金额（元）</view>
				<view class="total-value">{{info.safe_sum}}</view>
				<view class="no-worry-info flex justify-between">
					<view class="flex flex-column align-start">
						<text class="info-label">昨日收益(元)</text>
						<text class="info-value">{{info.safe_shouyi_last}}</text>
					</view>
					<view class="flex flex-column align-center">
						<text class="info-label">推广收益(元)</text>
						<text class="info-value">{{info.safe_shouyi_y}}</text>
					</view>
					<view class="flex flex-column align-end">
						<text class="info-label">累日收益(元)</text>
						<text class="info-value">{{info.safe_shouyi}}</text>
					</view>
				</view>
				<view class="expend-info" v-if="isExpend">
					<view class="expend-line flex">
						<view class="flex  align-center line-item">
							<text class="expend-label">持有金额</text>
							<text class="expend-value">{{info.safe_chi}}</text>
						</view>
						<view class="flex align-center line-item">
							<text class="expend-label">转入待到账</text>
							<text class="expend-value">{{info.safe_ru}}</text>
						</view>
					</view>
					<view class="expend-line flex">
						<view class="flex  align-center line-item">
							<text class="expend-label">昨日分红</text>
							<text class="expend-value">{{info.safe_shouyi_last}}</text>
						</view>
						<view class="flex align-center line-item">
							<text class="expend-label">转出待到账</text>
							<text class="expend-value">{{info.safe_chu}}</text>
						</view>
					</view>
				</view>
				<view class="flex justify-center expend-line">
					<u-icon name="arrow-down" color="#fff" class="arrow-down" :class="isExpend?'arrow-down-active':''"
						size="40" @tap="isExpend=!isExpend"></u-icon>
				</view>
			</view>
		</view>
		<view class="menu-wrapper flex align-center justify-center">
			<router-link to="/pages/moneyTransfer/moneyTransfer" class="withdraw-btn flex align-center justify-center">
				<view class="withdraw-btn-icon"></view>
				<text class="menu-text">转出</text>
			</router-link>
			<router-link to="/pages/moneyCharge/moneyCharge" class="charge-btn flex align-center justify-center">
				<view class="charge-btn-icon"></view>
				<text class="menu-text">转入</text>
			</router-link>
		</view>
		<view class="my-teamer-wrapper flex justify-between align-center">
			<view class="my-teamer-msg flex flex-column">
				<text class="my-teamer-title">我的团队</text>
				<text class="my-teamer-desc">团队邀请的佣金收入</text>
			</view>
			<router-link class="check-btn" to="">去查看</router-link>
		</view>
		<view class="banner-wrapper">
			<view class="banner"></view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				isExpend: false,
				info: {}
			};
		},
		methods: {
			back() {
				this.$Router.back(1)
			}
		},
		async onShow() {
			try {
				this.info = await this.$u.api.getOnWorryInfoApi()
			} catch (e) {
				//TODO handle the exception
			}
		}
	}
</script>

<style lang="scss">
	.container {
		.placeholder {
			&::after {
				content: " ";
				height: 100rpx;
				display: block;
			}
		}

		.custom-navigation {
			padding: 0 30rpx;
			position: fixed;
			top: var(--status-bar-height);
			left: 0;
			width: 100%;
			height: 100rpx;
			background: #fff;

			.header-title {
				font-size: 36rpx;
				font-weight: 600;
				color: #000000;
			}

			.account-record {
				font-size: 24rpx;
				color: $color-blue;
			}
		}

		.info-wrapper {
			background: linear-gradient(128deg, #3B65E1 0%, #4571EC 100%);

			.attr-list {
				height: 74rpx;
				background: rgba($color: #000000, $alpha: 0.2);

				.attr-item {
					flex: 1;

					.attr-icon {
						margin-right: 10rpx;
						width: 32rpx;
						height: 32rpx;
					}

					.attr-icon-1 {
						background: url("~@/static/images/noWorry/attr-icon-1.png");
						background-size: 100% 100%;
					}

					.attr-icon-2 {
						background: url("~@/static/images/noWorry/attr-icon-2.png");
						background-size: 100% 100%;
					}

					.attr-icon-3 {
						background: url("~@/static/images/noWorry/attr-icon-3.png");
						background-size: 100% 100%;
					}

					.attr-text {
						font-size: 24rpx;
						color: #fff;
					}
				}
			}

			.total-money-info {
				padding: 14rpx 30rpx 0;

				.total-label {
					font-size: 24rpx;
					color: #fff;
				}

				.total-value {
					font-size: 48rpx;
					font-weight: 600;
					color: #FFFFFF;
					line-height: 66rpx;
				}

				.no-worry-info {
					margin-top: 30rpx;

					.info-label {
						font-size: 24rpx;
						color: #fff;
					}

					.info-value {
						margin-top: 8rpx;
						font-size: 30rpx;
						font-weight: 600;
						color: #FFFFFF;
					}
				}

				.expend-info {
					margin-top: 22rpx;
					padding: 24rpx 0 30rpx 22rpx;
					height: 140rpx;
					box-sizing: border-box;
					background: linear-gradient(270deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.16) 100%);
					animation: expend-1 .3s ease;
					transform: translateZ(0);
				}

				.expend-label {
					margin-right: 10rpx;
					font-size: 24rpx;
					color: #FFFFFF;
				}

				.expend-value {
					font-size: 30rpx;
					font-weight: 600;
					color: #FFFFFF;
				}

				.mr-136 {
					margin-right: 136rpx;
				}

				.expend-line {
					margin-top: 10rpx;
					height: 40rpx;

					.line-item {
						width: 50%;
					}

					.arrow-down {
						transition: all .3s ease;
					}

					.arrow-down-active {
						transform: rotate(180deg);
					}
				}

				@keyframes expend-1 {
					0% {
						height: 0;
					}

					100% {
						height: 140rpx;
					}
				}
			}
		}

		.menu-wrapper {
			height: 158rpx;
			background-color: #fff;

			.withdraw-btn {
				width: 334rpx;
				height: 96rpx;
				background: #F8FAFF;
				border-radius: 48rpx;

				.withdraw-btn-icon {
					margin-right: 20rpx;
					width: 48rpx;
					height: 48rpx;
					background: url("~@/static/images/noWorry/withdraw-btn-icon.png");
					background-size: 100% 100%;
				}
			}

			.charge-btn {
				width: 334rpx;
				height: 96rpx;
				background: #F8FAFF;
				border-radius: 48rpx;

				.charge-btn-icon {
					margin-right: 20rpx;
					width: 48rpx;
					height: 48rpx;
					background: url("~@/static/images/noWorry/charge-btn-icon.png");
					background-size: 100% 100%;
				}
			}

			.menu-text {
				font-size: 32rpx;
				font-weight: 400;
				color: #333333;
			}
		}

		.my-teamer-wrapper {
			padding: 0 40rpx;
			margin: 30rpx 30rpx 24rpx;
			height: 168rpx;
			background: #FFFFFF;
			box-shadow: 0px 0px 10rpx 4rpx rgba(192, 192, 192, 0.04);
			border-radius: 16rpx;

			.my-teamer-msg {
				.my-teamer-title {
					font-size: 32rpx;
					font-weight: 500;
					color: #000000;
				}

				.my-teamer-desc {
					margin-top: 10rpx;
					font-size: 24rpx;
					color: rgba(0, 0, 0, 0.6);
				}
			}

			.check-btn {
				font-size: 24rpx;
				color: #FFFFFF;
				width: 132rpx;
				height: 54rpx;
				line-height: 54rpx;
				text-align: center;
				background: $color-blue;
				border-radius: 27rpx;
			}
		}

		.banner-wrapper {
			padding: 24rpx 30rpx;
			background-color: #fff;

			.banner {
				height: 200rpx;
				background: url("~@/static/images/noWorry/banner.png");
				background-size: 100% 100%;
			}
		}
	}
</style>
